home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Games / MAME / src / drivers / jack.c < prev    next >
C/C++ Source or Header  |  2000-04-04  |  25KB  |  696 lines

  1. /***************************************************************************
  2.  
  3. Jack the Giant Killer memory map (preliminary)
  4.  
  5. driver by Brad Oliver
  6.  
  7.  
  8. Main CPU
  9. --------
  10. 0000-3fff  ROM
  11. 4000-5fff  RAM
  12. b000-b07f  sprite ram
  13. b400       command for sound CPU
  14. b500-b505  input ports
  15. b506       screen flip off
  16. b507       screen flip on
  17. b600-b61f  palette ram
  18. b800-bbff  video ram
  19. bc00-bfff  color ram
  20. c000-ffff  More ROM
  21.  
  22. Sound CPU (appears to run in interrupt mode 1)
  23. ---------
  24. 0000-0fff  ROM
  25. 1000-1fff  ROM (Zzyzzyxx only)
  26. 4000-43ff  RAM
  27. 6000-6fff  R/C filter ???
  28.  
  29. I/O
  30. ---
  31. 0x40: Read - ay-8910 port 0
  32.       Write - ay-8910 write
  33. 0x80: Write - ay-8910 control
  34.  
  35. The 2 ay-8910 read ports are responsible for reading the sound commands.
  36.  
  37. ***************************************************************************/
  38.  
  39. #include "driver.h"
  40. #include "vidhrdw/generic.h"
  41. #include "cpu/z80/z80.h"
  42.  
  43.  
  44. WRITE_HANDLER( jack_paletteram_w );
  45. void jack_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
  46. READ_HANDLER( jack_flipscreen_r );
  47. WRITE_HANDLER( jack_flipscreen_w );
  48.  
  49.  
  50. static int timer_rate;
  51.  
  52. static READ_HANDLER( timer_r )
  53. {
  54.     /* wrong! there should be no need for timer_rate, the same function */
  55.     /* should work for both games */
  56.     return cpu_gettotalcycles() / timer_rate;
  57. }
  58.  
  59.  
  60. static WRITE_HANDLER( jack_sh_command_w )
  61. {
  62.     soundlatch_w(0,data);
  63.     cpu_cause_interrupt(1, Z80_IRQ_INT);
  64. }
  65.  
  66.  
  67. static struct MemoryReadAddress readmem[] =
  68. {
  69.     { 0x0000, 0x3fff, MRA_ROM },
  70.     { 0x4000, 0x5fff, MRA_RAM },
  71.     { 0xb000, 0xb07f, MRA_RAM },
  72.     { 0xb500, 0xb500, input_port_0_r },
  73.     { 0xb501, 0xb501, input_port_1_r },
  74.     { 0xb502, 0xb502, input_port_2_r },
  75.     { 0xb503, 0xb503, input_port_3_r },
  76.     { 0xb504, 0xb504, input_port_4_r },
  77.     { 0xb505, 0xb505, input_port_5_r },
  78.     { 0xb506, 0xb507, jack_flipscreen_r },
  79.     { 0xb800, 0xbfff, MRA_RAM },
  80.     { 0xc000, 0xffff, MRA_ROM },
  81.     { -1 }    /* end of table */
  82. };
  83.  
  84. static struct MemoryWriteAddress writemem[] =
  85. {
  86.     { 0x0000, 0x3fff, MWA_ROM },
  87.     { 0x4000, 0x5fff, MWA_RAM },
  88.     { 0xb000, 0xb07f, MWA_RAM, &spriteram, &spriteram_size },
  89.     { 0xb400, 0xb400, jack_sh_command_w },
  90.     { 0xb506, 0xb507, jack_flipscreen_w },
  91.     { 0xb600, 0xb61f, jack_paletteram_w, &paletteram },
  92.     { 0xb800, 0xbbff, videoram_w, &videoram, &videoram_size },
  93.     { 0xbc00, 0xbfff, colorram_w, &colorram },
  94.     { 0xc000, 0xffff, MWA_ROM },
  95.     { -1 }    /* end of table */
  96. };
  97.  
  98. static struct MemoryReadAddress sound_readmem[] =
  99. {
  100.     { 0x0000, 0x1fff, MRA_ROM },
  101.     { 0x4000, 0x43ff, MRA_RAM },
  102.     { -1 }    /* end of table */
  103. };
  104.  
  105. static struct MemoryWriteAddress sound_writemem[] =
  106. {
  107.     { 0x0000, 0x1fff, MWA_ROM },
  108.     { 0x4000, 0x43ff, MWA_RAM },
  109.     { 0x6000, 0x6fff, MWA_NOP },  /* R/C filter ??? */
  110.     { -1 }    /* end of table */
  111. };
  112.  
  113.  
  114. static struct IOReadPort sound_readport[] =
  115. {
  116.     { 0x40, 0x40, AY8910_read_port_0_r },
  117.     { -1 }    /* end of table */
  118. };
  119.  
  120. static struct IOWritePort sound_writeport[] =
  121. {
  122.     { 0x80, 0x80, AY8910_control_port_0_w },
  123.     { 0x40, 0x40, AY8910_write_port_0_w },
  124.     { -1 }    /* end of table */
  125. };
  126.  
  127.  
  128.  
  129. INPUT_PORTS_START( jack )
  130.     PORT_START      /* DSW1 */
  131.     PORT_DIPNAME( 0x03, 0x00, DEF_STR( Coin_B ) )
  132.     PORT_DIPSETTING(    0x03, DEF_STR( 4C_3C ) )
  133.     PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )
  134.     PORT_DIPSETTING(    0x01, DEF_STR( 1C_2C ) )
  135.     PORT_DIPSETTING(    0x02, DEF_STR( 1C_3C ) )
  136.     PORT_DIPNAME( 0x0c, 0x00, DEF_STR( Coin_A ) )
  137.     PORT_DIPSETTING(    0x08, DEF_STR( 3C_1C ) )
  138.     PORT_DIPSETTING(    0x04, DEF_STR( 2C_1C ) )
  139.     PORT_DIPSETTING(    0x0c, DEF_STR( 4C_3C ) )
  140.     PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )
  141.     PORT_DIPNAME( 0x10, 0x00, DEF_STR( Lives ) )
  142.     PORT_DIPSETTING(    0x00, "3" )
  143.     PORT_DIPSETTING(    0x10, "5" )
  144.     PORT_DIPNAME( 0x20, 0x00, DEF_STR( Bonus_Life ) )
  145.     PORT_DIPSETTING(    0x00, "Every 10000" )
  146.     PORT_DIPSETTING(    0x20, "10000 Only" )
  147.     PORT_DIPNAME( 0x40, 0x00, DEF_STR( Difficulty ) )
  148.     PORT_DIPSETTING(    0x00, "Start on Level 1" )
  149.     PORT_DIPSETTING(    0x40, "Start on Level 5" )
  150.     PORT_DIPNAME( 0x80, 0x00, "Bullets per Bean Collected" )
  151.     PORT_DIPSETTING(    0x00, "1" )
  152.     PORT_DIPSETTING(    0x80, "2" )
  153.  
  154.     PORT_START      /* DSW2 */
  155.     PORT_DIPNAME( 0x01, 0x01, DEF_STR( Cabinet ) )
  156.     PORT_DIPSETTING(    0x01, DEF_STR( Upright ) )
  157.     PORT_DIPSETTING(    0x00, DEF_STR( Cocktail ) )
  158.     PORT_DIPNAME( 0x02, 0x00, DEF_STR( Unknown ) )  // Most likely unused
  159.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  160.     PORT_DIPSETTING(    0x02, DEF_STR( On ) )
  161.     PORT_DIPNAME( 0x04, 0x00, DEF_STR( Unknown ) )  // Most likely unused
  162.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  163.     PORT_DIPSETTING(    0x04, DEF_STR( On ) )
  164.     PORT_DIPNAME( 0x08, 0x00, DEF_STR( Unknown ) )  // Most likely unused
  165.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  166.     PORT_DIPSETTING(    0x08, DEF_STR( On ) )
  167.     PORT_DIPNAME( 0x10, 0x00, DEF_STR( Unknown ) )  // Most likely unused
  168.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  169.     PORT_DIPSETTING(    0x10, DEF_STR( On ) )
  170.     PORT_SERVICE( 0x20, IP_ACTIVE_HIGH )
  171.     PORT_BITX (   0x40, 0x00, IPT_DIPSWITCH_NAME | IPF_CHEAT, "Invulnerability", IP_KEY_NONE, IP_JOY_NONE )
  172.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  173.     PORT_DIPSETTING(    0x40, DEF_STR( On ) )
  174.     PORT_BITX (   0x80, 0x00, IPT_DIPSWITCH_NAME | IPF_CHEAT, "255 Lives", IP_KEY_NONE, IP_JOY_NONE )
  175.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  176.     PORT_DIPSETTING(    0x80, DEF_STR( On ) )
  177.  
  178.     PORT_START      /* IN2 */
  179.     PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_START1 )
  180.     PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_START2 )
  181.     PORT_BIT( 0x1c, IP_ACTIVE_HIGH, IPT_UNKNOWN )  // Most likely unused
  182.     PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_COIN2 )
  183.     PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_COIN1 )
  184.     PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN )  // Most likely unused
  185.  
  186.     PORT_START      /* IN3 */
  187.     PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP | IPF_8WAY )
  188.     PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN | IPF_8WAY )
  189.     PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT | IPF_8WAY )
  190.     PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT | IPF_8WAY )
  191.     PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP | IPF_8WAY | IPF_COCKTAIL )
  192.     PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN | IPF_8WAY | IPF_COCKTAIL )
  193.     PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_COCKTAIL )
  194.     PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT | IPF_8WAY | IPF_COCKTAIL )
  195.  
  196.     PORT_START      /* IN4 */
  197.     PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 )
  198.     PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 )
  199.     PORT_BIT( 0xfc, IP_ACTIVE_HIGH, IPT_UNKNOWN ) // Most likely unused
  200.  
  201.     PORT_START      /* IN5 */
  202.     PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 | IPF_COCKTAIL )
  203.     PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 | IPF_COCKTAIL )
  204.     PORT_BIT( 0xfc, IP_ACTIVE_HIGH, IPT_UNKNOWN ) // Most likely unused
  205. INPUT_PORTS_END
  206.  
  207. INPUT_PORTS_START( zzyzzyxx )
  208.     PORT_START      /* DSW1 */
  209.     PORT_DIPNAME( 0x03, 0x00, DEF_STR( Coinage ) )
  210.     PORT_DIPSETTING(    0x01, DEF_STR( 2C_1C ) )
  211.     PORT_DIPSETTING(    0x03, DEF_STR( 4C_3C ) )
  212.     PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )
  213.     PORT_DIPSETTING(    0x02, DEF_STR( 1C_3C ) )
  214.     PORT_DIPNAME( 0x04, 0x00, DEF_STR( Lives ) )
  215.     PORT_DIPSETTING(    0x04, "2" )
  216.     PORT_DIPSETTING(    0x00, "3" )
  217.     PORT_DIPNAME( 0x08, 0x00, "Start with 2 Credits" )
  218.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  219.     PORT_DIPSETTING(    0x08, DEF_STR( On ) )
  220.     PORT_DIPNAME( 0x10, 0x00, DEF_STR( Demo_Sounds ) )
  221.     PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
  222.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  223.     PORT_DIPNAME( 0x20, 0x20, DEF_STR( Cabinet ) )
  224.     PORT_DIPSETTING(    0x20, DEF_STR( Upright ) )
  225.     PORT_DIPSETTING(    0x00, DEF_STR( Cocktail ) )
  226.     PORT_SERVICE( 0x40, IP_ACTIVE_HIGH )
  227.     PORT_DIPNAME( 0x80, 0x00, DEF_STR( Free_Play ) )
  228.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  229.     PORT_DIPSETTING(    0x80, DEF_STR( On ) )
  230.  
  231.     PORT_START      /* DSW2 */
  232.     PORT_DIPNAME( 0x03, 0x00, DEF_STR( Bonus_Life ) )
  233.     PORT_DIPSETTING(    0x02, "Never" )
  234.     PORT_DIPSETTING(    0x00, "10k/50k" )
  235.     PORT_DIPSETTING(    0x01, "25k/100k" )
  236.     PORT_DIPSETTING(    0x03, "100k/300k" )
  237.     PORT_DIPNAME( 0x04, 0x04, "2nd Bonus Given" )
  238.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  239.     PORT_DIPSETTING(    0x04, DEF_STR( On ) )
  240.     PORT_DIPNAME( 0x08, 0x00, "Starting Laps" )
  241.     PORT_DIPSETTING(    0x00, "2" )
  242.     PORT_DIPSETTING(    0x08, "3" )
  243.     PORT_DIPNAME( 0x10, 0x00, "Difficulty of Pleasing Lola" )
  244.     PORT_DIPSETTING(    0x00, "Easy" )
  245.     PORT_DIPSETTING(    0x10, "Hard" )
  246.     PORT_DIPNAME( 0x20, 0x00, "Show Intermissions" )
  247.     PORT_DIPSETTING(    0x00, DEF_STR( No ) )
  248.     PORT_DIPSETTING(    0x20, DEF_STR( Yes ) )
  249.     PORT_DIPNAME( 0xc0, 0x00, "Extra Lives" )
  250.     PORT_DIPSETTING(    0x00, "None" )
  251.   //PORT_DIPSETTING(    0x40, "None" )
  252.     PORT_DIPSETTING(    0x80, "4 under 4000 pts" )
  253.     PORT_DIPSETTING(    0xc0, "6 under 4000 pts" )
  254.  
  255.     PORT_START      /* IN2 */
  256.     PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_START1 )
  257.     PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_START2 )
  258.     PORT_BIT( 0x1c, IP_ACTIVE_HIGH, IPT_UNKNOWN )  // Most likely unused
  259.     PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_COIN1 )
  260.     PORT_BIT( 0xc0, IP_ACTIVE_HIGH, IPT_UNKNOWN )  // Most likely unused
  261.  
  262.     PORT_START      /* IN3 */
  263.     PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP | IPF_2WAY )
  264.     PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN | IPF_2WAY )
  265.     PORT_BIT( 0x0c, IP_ACTIVE_HIGH, IPT_UNUSED )
  266.     PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP | IPF_2WAY | IPF_COCKTAIL )
  267.     PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN | IPF_2WAY | IPF_COCKTAIL )
  268.     PORT_BIT( 0xc0, IP_ACTIVE_HIGH, IPT_UNUSED )
  269.  
  270.     PORT_START      /* IN4 */
  271.     PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 )
  272.     PORT_BIT( 0xfe, IP_ACTIVE_HIGH, IPT_UNKNOWN ) // Most likely unused
  273.  
  274.     PORT_START      /* IN5 */
  275.     PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 | IPF_COCKTAIL )
  276.     PORT_BIT( 0xfe, IP_ACTIVE_HIGH, IPT_UNKNOWN ) // Most likely unused
  277. INPUT_PORTS_END
  278.  
  279. INPUT_PORTS_START( freeze )
  280.     PORT_START      /* DSW1 */
  281.     PORT_DIPNAME( 0x01, 0x00, DEF_STR( Flip_Screen ) )
  282.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  283.     PORT_DIPSETTING(    0x01, DEF_STR( On ) )
  284.     PORT_SERVICE( 0x02, IP_ACTIVE_HIGH )
  285.     PORT_DIPNAME( 0x04, 0x00, DEF_STR( Difficulty ) )
  286.     PORT_DIPSETTING(    0x00, "Easy" )
  287.     PORT_DIPSETTING(    0x04, "Hard" )
  288.     PORT_DIPNAME( 0x08, 0x00, DEF_STR( Lives ) )
  289.     PORT_DIPSETTING(    0x00, "3" )
  290.     PORT_DIPSETTING(    0x08, "5" )
  291.     PORT_DIPNAME( 0x30, 0x00, DEF_STR( Bonus_Life ) )
  292.     PORT_DIPSETTING(    0x00, "10000" )
  293.     PORT_DIPSETTING(    0x10, "10000 40000" )
  294.     PORT_DIPSETTING(    0x20, "10000 60000" )
  295.     PORT_DIPSETTING(    0x30, "20000 100000" )
  296.     PORT_DIPNAME( 0xc0, 0x00, DEF_STR( Coinage ) )
  297.     PORT_DIPSETTING(    0x80, DEF_STR( 2C_1C ) )
  298.     PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )
  299.     PORT_DIPSETTING(    0x40, DEF_STR( 1C_2C ) )
  300.     PORT_DIPSETTING(    0xc0, DEF_STR( Free_Play ) )
  301.  
  302.     PORT_START      /* DSW2 */
  303.     /* probably unused */
  304.     PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  305.  
  306.     PORT_START      /* IN2 */
  307.     PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_START1 )
  308.     PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_START2 )
  309.     PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  310.     PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  311.     PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  312.     PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_COIN1 )
  313.     PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  314.     PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  315.  
  316.     PORT_START      /* IN3 */
  317.     PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT | IPF_2WAY )
  318.     PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT | IPF_2WAY )
  319.     PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  320.     PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  321.     PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  322.     PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  323.     PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  324.     PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  325.  
  326.     PORT_START      /* IN4 */
  327.     PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON2 )
  328.     PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1 )
  329.     PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  330.     PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  331.     PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  332.     PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  333.     PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  334.     PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  335.  
  336.     PORT_START      /* IN5 */
  337.     PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  338.     PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  339.     PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  340.     PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  341.     PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  342.     PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  343.     PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  344.     PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  345. INPUT_PORTS_END
  346.  
  347.  
  348.  
  349. static struct GfxLayout charlayout =
  350. {
  351.     8,8,    /* 8*8 characters */
  352.     1024,    /* 1024 characters */
  353.     2,    /* 2 bits per pixel */
  354.     { 0, 1024*8*8 },    /* the two bitplanes are seperated */
  355.     { 0, 1, 2, 3, 4, 5, 6, 7 },
  356.     { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
  357.     8*8    /* every char takes 16 bytes */
  358. };
  359.  
  360. static struct GfxDecodeInfo gfxdecodeinfo[] =
  361. {
  362.     { REGION_GFX1, 0, &charlayout, 0, 8 },
  363.     { -1 } /* end of array */
  364. };
  365.  
  366.  
  367.  
  368. static struct AY8910interface ay8910_interface =
  369. {
  370.     1,    /* 1 chip */
  371.     18000000/12,    /* 1.5 MHz */
  372.     { 100 },
  373.     { soundlatch_r },
  374.     { timer_r },
  375.     { 0 },
  376.     { 0 }
  377. };
  378.  
  379.  
  380. static struct MachineDriver machine_driver_jack =
  381. {
  382.     /* basic machine hardware */
  383.     {
  384.         {
  385.             CPU_Z80,
  386.             18000000/6,    /* 3 MHz */
  387.             readmem,writemem,0,0,
  388.             interrupt,1
  389.         },
  390.         {
  391.             CPU_Z80 | CPU_AUDIO_CPU,
  392.             18000000/12,    /* 1.5 MHz */
  393.             sound_readmem,sound_writemem,sound_readport,sound_writeport,
  394.             ignore_interrupt,0    /* IRQs are caused by the main CPU */
  395.         }
  396.     },
  397.     60, DEFAULT_60HZ_VBLANK_DURATION,    /* frames per second, vblank duration */
  398.     1,    /* 1 CPU slice per frame - interleaving is forced when a sound command is written */
  399.     0,
  400.  
  401.     /* video hardware */
  402.     32*8, 32*8, { 0*8, 32*8-1, 2*8, 30*8-1 },
  403.     gfxdecodeinfo,
  404.     32, 32,
  405.     0,
  406.  
  407.     VIDEO_TYPE_RASTER|VIDEO_MODIFIES_PALETTE,
  408.     0,
  409.     generic_vh_start,
  410.     generic_vh_stop,
  411.     jack_vh_screenrefresh,
  412.  
  413.     /* sound hardware */
  414.     0,0,0,0,
  415.     {
  416.         {
  417.             SOUND_AY8910,
  418.             &ay8910_interface
  419.         }
  420.     }
  421. };
  422.  
  423.  
  424. /***************************************************************************
  425.  
  426.   Game driver(s)
  427.  
  428. ***************************************************************************/
  429.  
  430. ROM_START( jack )
  431.     ROM_REGION( 0x10000, REGION_CPU1 )    /* 64k for code */
  432.     ROM_LOAD( "j8",           0x0000, 0x1000, 0xc8e73998 )
  433.     ROM_LOAD( "jgk.j6",       0x1000, 0x1000, 0x36d7810e )
  434.     ROM_LOAD( "jgk.j7",       0x2000, 0x1000, 0xb15ff3ee )
  435.     ROM_LOAD( "jgk.j5",       0x3000, 0x1000, 0x4a63d242 )
  436.     ROM_LOAD( "jgk.j3",       0xc000, 0x1000, 0x605514a8 )
  437.     ROM_LOAD( "jgk.j4",       0xd000, 0x1000, 0xbce489b7 )
  438.     ROM_LOAD( "jgk.j2",       0xe000, 0x1000, 0xdb21bd55 )
  439.     ROM_LOAD( "jgk.j1",       0xf000, 0x1000, 0x49fffe31 )
  440.  
  441.     ROM_REGION( 0x10000, REGION_CPU2 )    /* 64k for the audio CPU */
  442.     ROM_LOAD( "jgk.j9",       0x0000, 0x1000, 0xc2dc1e00 )
  443.  
  444.     ROM_REGION( 0x4000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  445.     ROM_LOAD( "jgk.j12",      0x0000, 0x1000, 0xce726df0 )
  446.     ROM_LOAD( "jgk.j13",      0x1000, 0x1000, 0x6aec2c8d )
  447.     ROM_LOAD( "jgk.j11",      0x2000, 0x1000, 0xfd14c525 )
  448.     ROM_LOAD( "jgk.j10",      0x3000, 0x1000, 0xeab890b2 )
  449. ROM_END
  450.  
  451. ROM_START( jack2 )
  452.     ROM_REGION( 0x10000, REGION_CPU1 )    /* 64k for code */
  453.     ROM_LOAD( "jgk.j8",       0x0000, 0x1000, 0xfe229e20 )
  454.     ROM_LOAD( "jgk.j6",       0x1000, 0x1000, 0x36d7810e )
  455.     ROM_LOAD( "jgk.j7",       0x2000, 0x1000, 0xb15ff3ee )
  456.     ROM_LOAD( "jgk.j5",       0x3000, 0x1000, 0x4a63d242 )
  457.     ROM_LOAD( "jgk.j3",       0xc000, 0x1000, 0x605514a8 )
  458.     ROM_LOAD( "jgk.j4",       0xd000, 0x1000, 0xbce489b7 )
  459.     ROM_LOAD( "jgk.j2",       0xe000, 0x1000, 0xdb21bd55 )
  460.     ROM_LOAD( "jgk.j1",       0xf000, 0x1000, 0x49fffe31 )
  461.  
  462.     ROM_REGION( 0x10000, REGION_CPU2 )    /* 64k for the audio CPU */
  463.     ROM_LOAD( "jgk.j9",       0x0000, 0x1000, 0xc2dc1e00 )
  464.  
  465.     ROM_REGION( 0x4000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  466.     ROM_LOAD( "jgk.j12",      0x0000, 0x1000, 0xce726df0 )
  467.     ROM_LOAD( "jgk.j13",      0x1000, 0x1000, 0x6aec2c8d )
  468.     ROM_LOAD( "jgk.j11",      0x2000, 0x1000, 0xfd14c525 )
  469.     ROM_LOAD( "jgk.j10",      0x3000, 0x1000, 0xeab890b2 )
  470. ROM_END
  471.  
  472. ROM_START( jack3 )
  473.     ROM_REGION( 0x10000, REGION_CPU1 )    /* 64k for code */
  474.     ROM_LOAD( "jack8",        0x0000, 0x1000, 0x632151d2 )
  475.     ROM_LOAD( "jack6",        0x1000, 0x1000, 0xf94f80d9 )
  476.     ROM_LOAD( "jack7",        0x2000, 0x1000, 0xc830ff1e )
  477.     ROM_LOAD( "jack5",        0x3000, 0x1000, 0x8dea17e7 )
  478.     ROM_LOAD( "jgk.j3",       0xc000, 0x1000, 0x605514a8 )
  479.     ROM_LOAD( "jgk.j4",       0xd000, 0x1000, 0xbce489b7 )
  480.     ROM_LOAD( "jgk.j2",       0xe000, 0x1000, 0xdb21bd55 )
  481.     ROM_LOAD( "jack1",        0xf000, 0x1000, 0x7e75ea3d )
  482.  
  483.     ROM_REGION( 0x10000, REGION_CPU2 )    /* 64k for the audio CPU */
  484.     ROM_LOAD( "jgk.j9",       0x0000, 0x1000, 0xc2dc1e00 )
  485.  
  486.     ROM_REGION( 0x4000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  487.     ROM_LOAD( "jack12",       0x0000, 0x1000, 0x80320647 )
  488.     ROM_LOAD( "jgk.j13",      0x1000, 0x1000, 0x6aec2c8d )
  489.     ROM_LOAD( "jgk.j11",      0x2000, 0x1000, 0xfd14c525 )
  490.     ROM_LOAD( "jgk.j10",      0x3000, 0x1000, 0xeab890b2 )
  491. ROM_END
  492.  
  493. ROM_START( treahunt )
  494.     ROM_REGION( 2*0x10000, REGION_CPU1 )    /* 64k for code + 64k for decrypted opcodes */
  495.     ROM_LOAD( "thunt-1.f2",   0x0000, 0x1000, 0x0b35858c )
  496.     ROM_LOAD( "thunt-2.f3",   0x1000, 0x1000, 0x67305a51 )
  497.     ROM_LOAD( "thunt-3.4f",   0x2000, 0x1000, 0xd7a969c3 )
  498.     ROM_LOAD( "thunt-4.6f",   0x3000, 0x1000, 0x2483f14d )
  499.     ROM_LOAD( "thunt-5.7f",   0xc000, 0x1000, 0xc69d5e21 )
  500.     ROM_LOAD( "thunt-6.7e",   0xd000, 0x1000, 0x11bf3d49 )
  501.     ROM_LOAD( "thunt-7.6e",   0xe000, 0x1000, 0x7c2d6279 )
  502.     ROM_LOAD( "thunt-8.4e",   0xf000, 0x1000, 0xf73b86fb )
  503.  
  504.     ROM_REGION( 0x10000, REGION_CPU2 )    /* 64k for the audio CPU */
  505.     ROM_LOAD( "jgk.j9",       0x0000, 0x1000, 0xc2dc1e00 )
  506.  
  507.     ROM_REGION( 0x4000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  508.     ROM_LOAD( "thunt-13.a4",  0x0000, 0x1000, 0xe03f1f09 )
  509.     ROM_LOAD( "thunt-12.a3",  0x1000, 0x1000, 0xda4ee9eb )
  510.     ROM_LOAD( "thunt-10.a1",  0x2000, 0x1000, 0x51ec7934 )
  511.     ROM_LOAD( "thunt-11.a2",  0x3000, 0x1000, 0xf9781143 )
  512. ROM_END
  513.  
  514. ROM_START( zzyzzyxx )
  515.     ROM_REGION( 0x10000, REGION_CPU1 )    /* 64k for code */
  516.     ROM_LOAD( "a.2f",         0x0000, 0x1000, 0xa9102e34 )
  517.     ROM_LOAD( "zzyzzyxx.b",   0x1000, 0x1000, 0xefa9d4c6 )
  518.     ROM_LOAD( "zzyzzyxx.c",   0x2000, 0x1000, 0xb0a365b1 )
  519.     ROM_LOAD( "zzyzzyxx.d",   0x3000, 0x1000, 0x5ed6dd9a )
  520.     ROM_LOAD( "zzyzzyxx.e",   0xc000, 0x1000, 0x5966fdbf )
  521.     ROM_LOAD( "f.7e",         0xd000, 0x1000, 0x12f24c68 )
  522.     ROM_LOAD( "g.6e",         0xe000, 0x1000, 0x408f2326 )
  523.     ROM_LOAD( "h.4e",         0xf000, 0x1000, 0xf8bbabe0 )
  524.  
  525.     ROM_REGION( 0x10000, REGION_CPU2 )    /* 64k for the audio CPU */
  526.     ROM_LOAD( "i.5a",         0x0000, 0x1000, 0xc7742460 )
  527.     ROM_LOAD( "j.6a",         0x1000, 0x1000, 0x72166ccd )
  528.  
  529.     ROM_REGION( 0x4000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  530.     ROM_LOAD( "n.1c",         0x0000, 0x1000, 0x4f64538d )
  531.     ROM_LOAD( "m.1d",         0x1000, 0x1000, 0x217b1402 )
  532.     ROM_LOAD( "k.1b",         0x2000, 0x1000, 0xb8b2b8cc )
  533.     ROM_LOAD( "l.1a",         0x3000, 0x1000, 0xab421a83 )
  534. ROM_END
  535.  
  536. ROM_START( zzyzzyx2 )
  537.     ROM_REGION( 0x10000, REGION_CPU1 )    /* 64k for code */
  538.     ROM_LOAD( "a.2f",         0x0000, 0x1000, 0xa9102e34 )
  539.     ROM_LOAD( "b.3f",         0x1000, 0x1000, 0x4277beab )
  540.     ROM_LOAD( "c.4f",         0x2000, 0x1000, 0x72ac99e1 )
  541.     ROM_LOAD( "d.6f",         0x3000, 0x1000, 0x7c7eec2b )
  542.     ROM_LOAD( "e.7f",         0xc000, 0x1000, 0xcffc4a68 )
  543.     ROM_LOAD( "f.7e",         0xd000, 0x1000, 0x12f24c68 )
  544.     ROM_LOAD( "g.6e",         0xe000, 0x1000, 0x408f2326 )
  545.     ROM_LOAD( "h.4e",         0xf000, 0x1000, 0xf8bbabe0 )
  546.  
  547.     ROM_REGION( 0x10000, REGION_CPU2 )    /* 64k for the audio CPU */
  548.     ROM_LOAD( "i.5a",         0x0000, 0x1000, 0xc7742460 )
  549.     ROM_LOAD( "j.6a",         0x1000, 0x1000, 0x72166ccd )
  550.  
  551.     ROM_REGION( 0x4000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  552.     ROM_LOAD( "n.1c",         0x0000, 0x1000, 0x4f64538d )
  553.     ROM_LOAD( "m.1d",         0x1000, 0x1000, 0x217b1402 )
  554.     ROM_LOAD( "k.1b",         0x2000, 0x1000, 0xb8b2b8cc )
  555.     ROM_LOAD( "l.1a",         0x3000, 0x1000, 0xab421a83 )
  556. ROM_END
  557.  
  558. ROM_START( brix )
  559.     ROM_REGION( 0x10000, REGION_CPU1 )    /* 64k for code */
  560.     ROM_LOAD( "a",            0x0000, 0x1000, 0x050e0d70 )
  561.     ROM_LOAD( "b",            0x1000, 0x1000, 0x668118ae )
  562.     ROM_LOAD( "c",            0x2000, 0x1000, 0xff5ed6cf )
  563.     ROM_LOAD( "d",            0x3000, 0x1000, 0xc3ae45a9 )
  564.     ROM_LOAD( "e",            0xc000, 0x1000, 0xdef99fa9 )
  565.     ROM_LOAD( "f",            0xd000, 0x1000, 0xdde717ed )
  566.     ROM_LOAD( "g",            0xe000, 0x1000, 0xadca02d8 )
  567.     ROM_LOAD( "h",            0xf000, 0x1000, 0xbc3b878c )
  568.  
  569.     ROM_REGION( 0x10000, REGION_CPU2 )    /* 64k for the audio CPU */
  570.     ROM_LOAD( "i.5a",         0x0000, 0x1000, 0xc7742460 )
  571.     ROM_LOAD( "j.6a",         0x1000, 0x1000, 0x72166ccd )
  572.  
  573.     ROM_REGION( 0x4000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  574.     ROM_LOAD( "n",            0x0000, 0x1000, 0x8064910e )
  575.     ROM_LOAD( "m.1d",         0x1000, 0x1000, 0x217b1402 )
  576.     ROM_LOAD( "k",            0x2000, 0x1000, 0xc7d7e2a0 )
  577.     ROM_LOAD( "l.1a",         0x3000, 0x1000, 0xab421a83 )
  578. ROM_END
  579.  
  580. ROM_START( freeze )
  581.     ROM_REGION( 0x10000, REGION_CPU1 )    /* 64k for code */
  582.     ROM_LOAD( "freeze.f2",    0x0000, 0x1000, 0x0a431665 )
  583.     ROM_LOAD( "freeze.f3",    0x1000, 0x1000, 0x1189b8ad )
  584.     ROM_LOAD( "freeze.f4",    0x2000, 0x1000, 0x10c4a5ea )
  585.     ROM_LOAD( "freeze.f5",    0x3000, 0x1000, 0x16024c53 )
  586.     ROM_LOAD( "freeze.f7",    0xc000, 0x1000, 0xea0b0765 )
  587.     ROM_LOAD( "freeze.e7",    0xd000, 0x1000, 0x1155c00b )
  588.     ROM_LOAD( "freeze.e5",    0xe000, 0x1000, 0x95c18d75 )
  589.     ROM_LOAD( "freeze.e4",    0xf000, 0x1000, 0x7e8f5afc )
  590.  
  591.     ROM_REGION( 0x10000, REGION_CPU2 )    /* 64k for the audio CPU */
  592.     ROM_LOAD( "freeze.a1",    0x0000, 0x1000, 0x7771f5b9 )
  593.  
  594.     ROM_REGION( 0x4000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  595.     ROM_LOAD( "freeze.5a",    0x0000, 0x1000, 0x6c8a98a0 )
  596.     ROM_LOAD( "freeze.3a",    0x1000, 0x1000, 0x6d2125e4 )
  597.     ROM_LOAD( "freeze.1a",    0x2000, 0x1000, 0x3a7f2fa9 )
  598.     ROM_LOAD( "freeze.2a",    0x3000, 0x1000, 0xdd70ddd6 )
  599. ROM_END
  600.  
  601. ROM_START( sucasino )
  602.     ROM_REGION( 0x10000, REGION_CPU1 )    /* 64k for code */
  603.     ROM_LOAD( "1",             0x0000, 0x1000, 0xe116e979 )
  604.     ROM_LOAD( "2",            0x1000, 0x1000, 0x2a2635f5 )
  605.     ROM_LOAD( "3",             0x2000, 0x1000, 0x69864d90 )
  606.     ROM_LOAD( "4",             0x3000, 0x1000, 0x174c9373 )
  607.     ROM_LOAD( "5",             0xc000, 0x1000, 0x115bcb1e )
  608.     ROM_LOAD( "6",             0xd000, 0x1000, 0x434caa17 )
  609.     ROM_LOAD( "7",             0xe000, 0x1000, 0x67c68b82 )
  610.     ROM_LOAD( "8",             0xf000, 0x1000, 0xf5b63006 )
  611.  
  612.     ROM_REGION( 0x10000, REGION_CPU2 )    /* 64k for the audio CPU */
  613.     ROM_LOAD( "9",             0x0000, 0x1000, 0x67cf8aec )
  614.  
  615.     ROM_REGION( 0x4000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  616.     ROM_LOAD( "11",            0x0000, 0x1000, 0xf92c4c5b )
  617.     /* 1000-1fff empty */
  618.     ROM_LOAD( "10",            0x2000, 0x1000, 0x3b0783ce )
  619.     /* 3000-3fff empty */
  620. ROM_END
  621.  
  622.  
  623.  
  624. static void treahunt_decode(void)
  625. {
  626.     int A;
  627.     unsigned char *rom = memory_region(REGION_CPU1);
  628.     int diff = memory_region_length(REGION_CPU1) / 2;
  629.     int data;
  630.  
  631.  
  632.     memory_set_opcode_base(0,rom+diff);
  633.  
  634.     /* Thanks to Mike Balfour for helping out with the decryption */
  635.     for (A = 0; A < 0x4000; A++)
  636.     {
  637.         data = rom[A];
  638.  
  639.         if (A & 0x1000)
  640.         {
  641.             /* unencrypted = D0 D2 D5 D1 D3 D6 D4 D7 */
  642.             rom[A+diff] =
  643.                  ((data & 0x01) << 7) |
  644.                  ((data & 0x02) << 3) |
  645.                  ((data & 0x04) << 4) |
  646.                   (data & 0x28) |
  647.                  ((data & 0x10) >> 3) |
  648.                  ((data & 0x40) >> 4) |
  649.                  ((data & 0x80) >> 7);
  650.  
  651.             if ((A & 0x04) == 0)
  652.             /* unencrypted = !D0 D2 D5 D1 D3 D6 D4 !D7 */
  653.                 rom[A+diff] ^= 0x81;
  654.         }
  655.         else
  656.         {
  657.             /* unencrypted = !D7 D2 D5 D1 D3 D6 D4 !D0 */
  658.             rom[A+diff] =
  659.                     (~data & 0x81) |
  660.                     ((data & 0x02) << 3) |
  661.                     ((data & 0x04) << 4) |
  662.                      (data & 0x28) |
  663.                     ((data & 0x10) >> 3) |
  664.                     ((data & 0x40) >> 4);
  665.         }
  666.     }
  667. }
  668.  
  669. static void init_jack(void)
  670. {
  671.     timer_rate = 128;
  672. }
  673.  
  674. static void init_treahunt(void)
  675. {
  676.     timer_rate = 128;
  677.     treahunt_decode();
  678. }
  679.  
  680. static void init_zzyzzyxx(void)
  681. {
  682.     timer_rate = 16;
  683. }
  684.  
  685.  
  686.  
  687. GAME( 1982, jack,     0,        jack, jack,     jack,     ROT90, "Cinematronics", "Jack the Giantkiller (set 1)" )
  688. GAME( 1982, jack2,    jack,     jack, jack,     jack,     ROT90, "Cinematronics", "Jack the Giantkiller (set 2)" )
  689. GAME( 1982, jack3,    jack,     jack, jack,     jack,     ROT90, "Cinematronics", "Jack the Giantkiller (set 3)" )
  690. GAME( 1982, treahunt, jack,     jack, jack,     treahunt, ROT90, "Hara Industries", "Treasure Hunt (Japan?)" )
  691. GAME( 1982, zzyzzyxx, 0,        jack, zzyzzyxx, zzyzzyxx, ROT90, "Cinematronics + Advanced Microcomputer Systems", "Zzyzzyxx (set 1)" )
  692. GAME( 1982, zzyzzyx2, zzyzzyxx, jack, zzyzzyxx, zzyzzyxx, ROT90, "Cinematronics + Advanced Microcomputer Systems", "Zzyzzyxx (set 2)" )
  693. GAME( 1982, brix,     zzyzzyxx, jack, zzyzzyxx, zzyzzyxx, ROT90, "Cinematronics + Advanced Microcomputer Systems", "Brix" )
  694. GAME( ????, freeze,   0,        jack, freeze,   jack,     ROT90, "Cinematronics", "Freeze" )
  695. GAME( 1982, sucasino, 0,        jack, jack,     jack,     ROT90, "Data Amusement", "Super Casino" )
  696.